<html>
<body>
<h3><div style="text-align: center">Ajouter des prix &agrave; la base de donn&eacute;es</div></h3>
<?php
require_once('pasmy/dbwaarden.php');
/*echo "dbhost = $dbhost<br>";*/

$mysql_id = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $mysql_id);

if(isset($_POST["toevoegen"])) {
		/*foreach($_POST as $sleutel => $waarde) {
			echo "sleutel = $sleutel en waarde = $waarde <br>";
		}*/
		
$afstand = explode("-",$_POST["kilom"]);
$km1 = $afstand[0];
$km2 = $afstand[1];
$aantalpaletten = $_POST["pals"];
/*echo "paletten = $aantalpaletten<br>";*/	
$metervloer = $_POST["lengte"];
$prijs = $_POST["prijs"];

	
	
$sql = "INSERT INTO `roussel`.`marquette` (`km1` ,`km2` ,`pal` ,`mp` ,`prix`)VALUES ('$km1', '$km2', '$aantalpaletten', '$metervloer', '$prijs')";

	
$res = mysql_query($sql, $mysql_id);
	
?>
<a href="prijzentoe.php" name="Terug"><h3><div style="text-align: center">Continuer</div></h3></a>
<?php	
	
exit;
	}
else {

$kilometers = array('-----','1-25','26-50','51-75','76-100','101-130','131-170','171-210','210-280','281-999');
$paletten = array('-----','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20');
$meters = array('-----','0.40','0.80','1.20','1.60','2.00','2.40','2.80','3.20','3.60','4.00','4.40','4.80','5.20','5.60','6.00','6.40','6.80','7.20','7.60','8.00');

?>
<table width="60%" align="center" border="1">
<tr><td colspan="4"><div style="text-align: center"><h3>Prix Marquettes</h3></div></td></tr>
<tr><td><div style="text-align: center"><h4>Distance</h4></div></td>
<td><div style="text-align: center"><h4>Nombre de palettes</h4></div></td>
<td><div style="text-align: center"><h4>M&egrave;tres planch&eacute;</h4></div></td>
<td><div style="text-align: center"><h4>Prix</h4></div></td></tr>
<tr><td><div style="text-align: center">
<form action="prijzentoe.php" method="post">
<select name="kilom">
<?php
while(list($key, $val)=each($kilometers)) {	 
		echo '<option value="'.$val.'">'.$val.'</option>';
}

?>
</select>
</div></td><td><div style="text-align: center">
<select name="pals">
<?php
while(list($key, $val)=each($paletten)) {
	
		echo '<option value="'.$val.'">'.$val.'</option>';
	
}
?>
</select>
</div></td><td><div style="text-align: center">
<select name="lengte">
<?php
while(list($key, $val)=each($meters)) {
	if (isset($lengte) && ($lengte == $val)) {
		echo '<option value="'.$val.'" selected>'.$val.'</option>';
	} else {
		echo '<option value="'.$val.'">'.$val.'</option>';
	}
}
?></select>
</div></td>
<td><div style="text-align: center"><input type="text" name="prijs" /></div></td></tr>
<tr><td colspan="4"><div style="text-align: center">

<input type="submit" name="toevoegen" value="Toevoegen" />
</div>
</form>
</td></tr>
</table>
<?php
}
?>
</body>
</html>